package org.apache.struts2.dispatcher.mapper;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class FixedActionMapper extends DefaultActionMapper {
	private static List<String> ignoredExtensions = new ArrayList<String>();

	static {
		ignoredExtensions.add(".css");
		ignoredExtensions.add(".js");
		ignoredExtensions.add(".gif");
		ignoredExtensions.add(".jpg");
		ignoredExtensions.add(".png");
		ignoredExtensions.add(".swf");
		ignoredExtensions.add(".html");
		ignoredExtensions.add(".zip");
		ignoredExtensions.add(".rar");
		ignoredExtensions.add(".doc");
		ignoredExtensions.add(".xls");
		ignoredExtensions.add(".txt");
		ignoredExtensions.add(".pdf");
	}

	String dropExtension(String name) {
		Iterator<String> it = ignoredExtensions.iterator();
		while (it.hasNext()) {
			if (name.endsWith(it.next())) return null;
		}
		return super.dropExtension(name);
	}
}
